import request from '@/utils/request'
/**
 * 获取权益包
 * http://192.168.88.247:4999/web/#/105/868
 * @param {*} data
 * @returns
 */
export function getAllPackages (data) {
  return request({
    url: '/api/v1/product/list',
    method: 'post',
    data
  })
}
/**
 * 获取权益包
 * http://192.168.88.247:4999/web/#/105/1133
 * @param {*} data
 * @returns
 */
export function getProducts (data) {
  return request({
    url: '/api/v1/product/package',
    method: 'post',
    data
  })
}
/**
 * 获取商品活动
 * http://192.168.88.247:4999/web/#/105?page_id=2624
 * @param {*} data
 * @returns
 */
export function getProductsActivity (data) {
  return request({
    url: '/api/v1/activity/product/list',
    method: 'post',
    data
  })
}
/**
 * 根据多权益包获取商品列表
 * http://192.168.88.247:4999/web/#/105/2010
 * @param {*} data
 * @returns
 */
export function getSomeProducts (data) {
  return request({
    url: '/api/v1/product/packages',
    method: 'post',
    data
  })
}
/**
 * 获取权益包
 * http://192.168.88.247:4999/web/#/105/1132
 * @param {*} data
 * @returns
 */
export function getPackagesList (data, isEncrypt = true) {
  return request({
    isEncrypt,
    url: '/api/v1/right_package/by_pids',
    method: 'post',
    data
  })
}
/**
 * 根据权益ID获取所在权益包
 * http://192.168.88.247:4999/web/#/105/869
 * @param {*} data
 * @returns
 */
export function getPackageByRights (data, isEncrypt = true) {
  return request({
    isEncrypt,
    url: '/api/v1/on_sale_package/rights',
    method: 'post',
    data
  })
}
/**
 * 根据权益包ID获取其下所有权益
 * http://192.168.88.247:4999/web/#/105/868
 * @param {*} data
 * @returns
 */
export function getRightsByPackage (data, isEncrypt = true) {
  return request({
    isEncrypt,
    url: '/api/v2/right_package/rights',
    method: 'post',
    data
  })
}

/**
 * 获取在售权益
 * http://192.168.88.247:4999/web/#/105/868
 * @param {*} data
 * @returns
 */
export function getSalePackage (data, isEncrypt = true) {
  return request({
    isEncrypt,
    url: '/api/v2/right_package/by_cat',
    method: 'post',
    data
  })
}
/**
 * 根据权益包id获取对应的权益信息
 * http://192.168.88.247:4999/web/#/105/1180
 * @param {*} data
 * @returns
 */
export function getPackageByPid (data, isEncrypt = true) {
  return request({
    isEncrypt,
    url: '/api/v1/right_package/by_pid',
    method: 'post',
    data
  })
}
/**
 * 根据权益包id获取对应的权益信息
 * http://192.168.88.247:4999/web/#/105/1180
 * @param {*} data
 * @returns
 */
export function getPackageByPidV2 (data, isEncrypt = true) {
  return request({
    isEncrypt,
    url: '/api/v2/right_package/by_pid',
    method: 'post',
    data
  })
}
/**
 * 领取7天权益包
 * http://192.168.88.247:4999/web/#/105/936
 * @param {*} data
 * @returns
 */
export function drawTrial (data, noMsg) {
  return request({
    noMsg,
    url: '/api/v1/right_package/draw_trial',
    method: 'post',
    data
  })
}

/**
 * 批量领取7天权益包
 * http://192.168.88.247:4999/web/#/105/936
 * @param {*} data
 * @returns
 */
export function batchDrawTrial (data, noMsg) {
  return request({
    noMsg,
    url: '/api/v1/right_package/multi_draw_trial',
    method: 'post',
    data
  })
}
